package com.ehl.capture.db;

import java.util.HashMap;
import java.util.Map;

public class DbConfig {
    public Map<String, String> getDbConfigMap() {
        Map map = new HashMap();
        map.put("jdbcurl", DBLoader.jdbcurl);
        map.put("user", DBLoader.user);
        map.put("password", DBLoader.password);
        map.put("minpoolsize", DBLoader.minpoolsize);
        map.put("maxpoolsize", DBLoader.maxpoolsize);
        map.put("initialpoolsize", DBLoader.initialpoolsize);
        map.put("acquireincrement", DBLoader.acquireincrement);
        map.put("maxidletime", DBLoader.maxidletime);
        map.put("acquireretryattempts", DBLoader.acquireretryattempts);
        map.put("acquireretrydelay", DBLoader.acquireretrydelay);
        map.put("checkouttimeout", DBLoader.checkouttimeout);
        map.put("debugunreturnedconnectionstacktraces",DBLoader.debugunreturnedconnectionstacktraces);
        map.put("unreturnedconnectiontimeout",DBLoader.unreturnedconnectiontimeout);
        return map;
    }

    public void init() {
        Map db = getDbConfigMap();
        DBPool.getInstance().initPool("db", db);
        DBPool.getInstance().initPool("ehl", null);
    }

    public static void main(String[] args) {
        new DbConfig().init();
        Object[][] obj = DBProxy.getMultiResult("db","select HPZL,substr(FZJG,0,1)||''||HPHM,ZT,QZBFQZ,YXQZ from T_TIRA_VEHICLE_L ");
        System.out.println(obj.length);
    }

    public void stop(){
        DBPool.getInstance().closeDataSources();
    }

    public boolean isSingle(){
        return false;
    }
}